package com.chinatgl.latte.ec.main.sort;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import com.chinatgl.latte.delegates.bottom.BottomItemDelegate;
import com.chinatgl.latte.ec.R;
import com.chinatgl.latte.ec.R2;
import com.chinatgl.latte.ec.main.sort.content.ContentDelegate;
import com.chinatgl.latte.ec.main.sort.list.VerticalListDelegate;

import butterknife.BindView;

/**
 * 文件描述: 分类界面
 * 作者: Created by 杨伟乔 on 2017/8/10 0010.
 * 版本号: 1.0
 */

public class SortDelegate extends BottomItemDelegate {

    @BindView(R2.id.et_shop)
    EditText etShop;

    @Override
    public void onBindView(@Nullable Bundle savedInstanceState, View rootView) {

    }

    @Override
    public CharSequence getTitle() {
        return "分类";
    }

    @Override
    public Object getContentView() {
        return R.layout.delegate_sort;
    }

    @Override
    public void initListener() {
        etShop.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(_mActivity, "点击搜索框", Toast.LENGTH_SHORT).show();
            }
        });
    }

    @Override
    public void initData() {
        stateLayout.showContentView();
    }

    @Override
    public void onLazyInitView(@Nullable Bundle savedInstanceState) {
        super.onLazyInitView(savedInstanceState);

        final VerticalListDelegate listDelegate = new VerticalListDelegate();
        getSupportDelegate().loadRootFragment(R.id.vertical_list_container, listDelegate);
        //设置右侧第一个分类显示，默认显示分类一
        getSupportDelegate().loadRootFragment(R.id.sort_content_container, ContentDelegate.newInstance(null));


    }
}
